﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessLogicLayer.DataObject
{
    public class Cost
    {
        public string ID { get; set; }
        public string CostID { get; set; }
        public string EditorUserID { get; set; }
        public string EditorUserName { get; set; }
        public string Price { get; set; }
        public string Description { get; set; }
        public string Timestamp { get; set; }
        public string BackColor { get; set; }

        public Cost(DataAccessLayer.Cost Cost)
        {
            this.ID = Cost.ID.ToString();
            this.CostID = Cost.CostID.ToString();
            this.EditorUserID = Cost.EditorUserID.ToString();
            this.EditorUserName = Cost.sUser.Users.Last().Username;
            this.Price = Cost.Price.ToString();
            this.Description = Cost.Description;
            this.Timestamp = Cost.Timestamp.ToHijriSolarString();
            this.BackColor = Cost.IsDeleted ? "#FF5555" : "#FFFFFF";
        }

        public static List<Cost> Convert(List<DataAccessLayer.Cost> Costs)
        {
            return (Costs.ConvertAll(new Converter<DataAccessLayer.Cost, Cost>(p => (new Cost(p)))));
        }
    }
}
